package cn.tedu.micro.demo.device.controller;

import cn.tedu.micro.demo.common.pojo.procotol.JsonResult;
import cn.tedu.micro.demo.common.pojo.vo.GunInfoVO;
import cn.tedu.micro.demo.device.service.DeviceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class DeviceController {
    /**
     * 请求方式：GET
     * 请求地址：/device/gun/info/{gunId}
     * 返回值：JsonResult<GunInfoVO>
     */
    @Autowired
    DeviceService deviceService;
    @GetMapping("/device/gun/info/{gunId}")
    public JsonResult<GunInfoVO> getGunStatus(@PathVariable Integer gunId) {
        // TODO: 调用业务层
        GunInfoVO gunInfoVO = deviceService.getGunStatus(gunId);
        return JsonResult.ok("ok",gunInfoVO);
    }
}
